package 树;

public class Demo08 {
    /*
    * 回溯
    * */
    static class Solution {
        private int count;
        private int path;

        public void sumNumbers(TreeNode root) {
            path = path*10+root.val;
            if(root.left == null && root.right == null){
                count+=path;
            }

            int tmp = path;
            if(root.left != null)sumNumbers(root.left);
            path = tmp;
            if(root.right != null)sumNumbers(root.right);

        }
    }



}
